extends Area2D

#是否会自己碎掉
@export var will_break: bool = false
#至少需要多少秒才碎
@export var break_min_time: float = 1.0

func _on_body_entered(body: Node2D) -> void:
	if will_break:
		var timer := Timer.new()
		timer.wait_time = break_min_time + randf_range(0, 2.0)
		timer.timeout.connect(func():
			#print("该销毁了")
			SoundManager.play_sfx("GlassBreak")
			queue_free()
			)
		self.add_child(timer)
		timer.start()
